import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserTaskRewardsVO, UserTaskRewardsForm, UserTaskRewardsQuery } from '@/api/mushcoin/userTaskRewards/types';

/**
 * 查询用户任务奖励列(H5)列表
 * @param query
 * @returns {*}
 */

export const listUserTaskRewards = (query?: UserTaskRewardsQuery): AxiosPromise<UserTaskRewardsVO[]> => {
  return request({
    url: '/mushcoin/userTaskRewards/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户任务奖励列(H5)详细
 * @param id
 */
export const getUserTaskRewards = (id: string | number): AxiosPromise<UserTaskRewardsVO> => {
  return request({
    url: '/mushcoin/userTaskRewards/' + id,
    method: 'get'
  });
};

/**
 * 新增用户任务奖励列(H5)
 * @param data
 */
export const addUserTaskRewards = (data: UserTaskRewardsForm) => {
  return request({
    url: '/mushcoin/userTaskRewards',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户任务奖励列(H5)
 * @param data
 */
export const updateUserTaskRewards = (data: UserTaskRewardsForm) => {
  return request({
    url: '/mushcoin/userTaskRewards',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户任务奖励列(H5)
 * @param id
 */
export const delUserTaskRewards = (id: string | number | Array<string | number>) => {
  return request({
    url: '/mushcoin/userTaskRewards/' + id,
    method: 'delete'
  });
};
